const m = 20;
Var board: array[0..9, 0..9] of integer;
    xp: array [0..m] of integer;
    yp: array [0..m] of integer;
    x0,y0,n : integer;


function search(k,x,y: integer): boolean; 
// 8 directions  up | 1, / 2, - 3, \ 4, etc.   
var i,j, xo, yo: integer;
    found:boolean;
begin
    found:=false;
    j:=0;
    xo:=x; yo:=y; 
    repeat   
      x:=xo; y:=yo; 
      inc (j);
       // case of variant
       case j of
         1: while board[x,y]=0 do dec(y);  
         2: while board[x,y]=0 do begin dec(y); inc(x) end; 
         3: while board[x,y]=0 do inc(x);  
         4: while board[x,y]=0 do begin inc(x); inc(y) end; 
         5: while board[x,y]=0 do inc (y);  
         6: while board[x,y]=0 do begin inc(y); dec(x)end; 
         7: while board[x,y]=0 do dec(x);  
         8: while board[x,y]=0 do begin dec(y); dec(x) end; 
       end;
       if  board[x,y]=1 then // variant is possible
       begin
          xp[k] := x;      
          yp[k] := y;      
          board[x,y]:=0; 
          if k<n then // solution is not complete
               found := search (k+1,x,y)
          else found:=true;
          if not (found) then 
                 board[x,y]:=1;
       end;        
    until  found or (j=8); 
    result:= found;
end;

          
    

procedure inp; 
var i,j, x, y: integer;
    s: string;
begin
    assign(input,'chess.txt');
    reset(input);
    readln(n);
    readln(s);
    x0 := ord(s[1])-ord('a') + 1;
    y0 := ord(s[2])-ord('0');
    for i:=1 to 8 do
      for j:=1 to 8 do 
        board[i,j] := 0;
    for i:=0 to 9 do 
    begin
        board[i,0] := -1;
        board[i,9] := -1;
        board[0,i] := -1;
        board[9,i] := -1;
    end;
    for i:=1 to n do
    begin
      readln(s);
      x := ord(s[1])-ord('a') + 1;
      y := ord(s[2])-ord('0');
      board[x,y] :=1;
    end;
   close(input);   
end;

procedure outp; 
var i: integer;
begin
    for i:=1 to n do 
      write(chr(xp[i]+ord('a') - 1), chr(yp[i]+ord('0')), ' ');
    writeln;
end;

   

//Ферзь бьет пешки
//Первое число - количество пешек, затем координаты ферзя, затем координаты пешек
begin
   inp();
   if search(1,x0,y0) then outp()
   else write('no');
end.
        
   
               
   
